package com.fc.v2.model.auto;

import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.date.DateUtil;
import java.util.Date;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Session implements Serializable {
    private static final long serialVersionUID = 1L;

	
	@ApiModelProperty(value = "id")
	private Integer id;
	
	@ApiModelProperty(value = "openid")
	private String openid;
	
	@ApiModelProperty(value = "登录标识")
	private String skey;
	
	@ApiModelProperty(value = "用户ID")
	private String userId;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	@ApiModelProperty(value = "获取时间")
	private Date gainTime;
	

	@JsonIgnore
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id =  id;
	}

	@JsonProperty("openid")
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid =  openid;
	}
	@JsonProperty("session_key")
	public String getSkey() {
		return skey;
	}

	public void setSkey(String skey) {
		this.skey =  skey;
	}
	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId =  userId;
	}
	@JsonIgnore
	public Date getGainTime() {
		return gainTime;
	}

	public void setGainTime(Date gainTime) {
		this.gainTime =  gainTime;
	}

										
	public Session(Integer id,String openid,String skey,String userId,Date gainTime) {
				
		this.id = id;
				
		this.openid = openid;
				
		this.skey = skey;
				
		this.userId = userId;
				
		this.gainTime = gainTime;
				
	}

	public Session() {
	    super();
	}

	public String dateToStringConvert(Date date) {
		if(date!=null) {
			return DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
		}
		return "";
	}
	

}